import axios from "axios";
const http = axios.create({
  baseURL: "http://www.ysqorz.top:8888/api/private/v1",
  timeout: 1000,
});
http.interceptors.request.use(
  (config) => {
    if (config.url !== "/login") {
      const token = sessionStorage.getItem("token");
      token && (config.headers.Authorization = token);
    }
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);
http.interceptors.response.use(
  (res) => {
    return res;
  },
  (error) => {
    return Promise.reject(error);
  }
);
export default http;
